import Vue from 'vue'
import Vuex from 'vuex'
//导入日志插件
import createLogger from 'vuex/dist/logger'
//导入持久化插件
import createPersistedState from "vuex-persistedstate";
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    collectlist:[]
  },
  getters: {
  },
  mutations: {
    collect(state,payload){//收藏店铺
      state.collectlist.push(payload)
    },
    cancel_collect(state,payload){//取消收藏
      var index = state.collectlist.findIndex((item)=>{
        return item.mtWmPoiId == payload.mtWmPoiId;
      })
      if(index != -1 ){
        state.collectlist.splice(index,1)
      }
    }
  },
  actions: {
  },
  modules: {
  },
  plugins:[ createLogger(),createPersistedState() ]
})
